package com.gl.saasservice.repository;

import com.gl.saasservice.entity.UserRole;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface UserRoleRepository extends JpaRepository<UserRole, Long>, JpaSpecificationExecutor<UserRole> {

    @Transactional
    void deleteByRoleId(Long id);

    @Transactional
    void deleteByUserId(String id);

    List<UserRole> findByUserId(Long userId);

    List<UserRole> findByRoleId(Long roleId);

    List<UserRole> findByRoleIdIn(List<Long> ids);
}
